from typing import List

class Solution:
    def isCovered(self, ranges: List[List[int]], left: int, right: int) -> bool:
        # 找到所有区间端点的最大值
        max_end = max([end for _, end in ranges])
        # 初始化差分数组
        diff = [0] * (max_end + 2)
        # 进行区间修改
        for start, end in ranges:
            diff[start] += 1
            diff[end + 1] -= 1
        # 计算前缀和数组
        pre = [0] * (max_end + 2)
        pre[0] = diff[0]
        for i in range(1, max_end + 2):
            pre[i] = pre[i - 1] + diff[i]
        # 检查 [left, right] 区间内的每个位置是否被覆盖
        for i in range(left, right + 1):
            if pre[i] <= 0:
                return False
        return True